s = input()
a = []
p = ["+", "-", "/", "*", "(", ")"]
r = ""
for i in s:
    if i in p:
        if r != "":
            a.append(int(r))
        r =""
        a.append(i)
    else:
        r += i
if r != "":
    a.append(int(r))
q = []
l = -1
s = []
v = "*/"
n = "-+"
for i in a:
    if not i in p:
        q.append(i)
    elif i in v or i in n:
        while not(len(s) == 0 or s[-1] == "(" or (s[-1] in n and i in v)):
            q.append(s[-1])
            s.pop(-1)
        s.append(i)
    elif i == "(":
        s.append(i)
    elif i == ")":
        while s[-1] != "(":
            q.append(s[-1])
            s.pop(-1)
        s.pop(-1)
while len(s) > 0:
    q.append(s[-1])
    s.pop(-1)
s = q
p = ["+", "-", "*", "/"]
a = []
o = 0
for i in s:
    if not i in p:
        a.append(int(i))
    elif i == "+":
        if len(a) > 1:
            y = a[-1] + a[-2]
            a.pop(-1)
            a.pop(-1)
            a.append(y)
        else:
            o = 1
    elif i == "-":
        if len(a) > 1:
            y = a[-2] - a[-1]
            a.pop(-1)
            a.pop(-1)
            a.append(y)
        else:
            o = 1
    elif i == "*":
        if len(a) > 1:
            y = a[-1] * a[-2]
            a.pop(-1)
            a.pop(-1)
            a.append(y)
        else:
            o = 1
    elif i == "/":
        if len(a) > 1:
            y = a[-2] // a[-1]
            a.pop(-1)
            a.pop(-1)
            a.append(y)
        else:
            o = 1
print(a[0])